namespace Collaboris.Saf.Actions.Wss.Tests.Generated
{
    using System;
    using System.Collections.Generic;
    using System.Web.UI.WebControls.WebParts;

    using Engine.Report;

    using Microsoft.SharePoint.WebPartPages;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Saf.Tests;
    using Entities;

    using SharePoint.Wss.Files;
    using SharePoint.Wss.Lists;
    using SharePoint.Wss.WebParts;

    using WebPart;

    using WebPart=Microsoft.SharePoint.WebPartPages.WebPart;

    /// <summary>
    /// This test was originally generated but has now been tested and verfiied by MJ
    /// </summary>
    [TestClass]
    public class RemoveWebPartsTest
    {
       [TestMethod]
        public void RemoveWebParts_Test()
        {
            WSSTestAssistant<RemoveWebParts, WebPartListInfo> removeWebParts =
                new WSSTestAssistant<RemoveWebParts, WebPartListInfo>(TestEnvironment.PublishingSite, 
                    "RemoveWebPartsTestWeb", "BLANKINTERNET#0");

            using (removeWebParts)
            {
                Guid listGuid = SPListHelper.GetListGuid(removeWebParts.TestWeb, "Pages");

                ListViewWebPart listViewWebPart = new ListViewWebPart();
                listViewWebPart.ListName = listGuid.ToString("B").ToUpper();
                listViewWebPart.ID = "MyListViewWebPart";
                listViewWebPart.Title = "MyListViewWebPart Title";

                SPFileHelper.CheckOutFile(removeWebParts.TestWeb.Url + @"/Pages/default.aspx");

                List<WebPart> webParts = new List<WebPart>() { listViewWebPart };
                SPWebPartHelper.AddWebParts(removeWebParts.TestWeb, "pages", "default.aspx", webParts, "TopZone", true, PersonalizationScope.Shared);
                MacroReport report = removeWebParts.DoMacro();

                Assert.IsNull(
                    SPWebPartHelper.GetWebPartFromPage(
                        removeWebParts.TestWeb, @"/Pages/default.aspx", listViewWebPart.ID, PersonalizationScope.Shared));

                
            }

        }

    }
}
